package com.security.domain.authority;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.GrantedAuthority;

import java.util.List;


/**
 * 角色
 * @author 大忽悠
 * @create 2022/10/8 9:59
 */
@Slf4j
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class CommonRole implements GrantedAuthority {
    /**
     * 角色名--角色是一种特殊的权限
     */
    private String authority;
    /**
     * 角色具备的权限
     */
    private List<CommonAuthority> allowedOperations;

    /**
     * @return 角色可以看成是一种特殊的权限
     */
    @Override
    public String getAuthority() {
        return authority;
    }
}
